SizesOK Function

public function SizesOK()

Users may call this function once to ensure that the kind parameters the module defines are available with the current compiler. We can't ensure that the two REAL kinds are actually four and eight bytes long, but we can ensure that they are distinct. Early Fortran 90 compilers would sometimes report incorrect results for the bit_size intrinsic, but I haven't seen this in a long time.

Arguments

None

Return Value logical


Variables

Type Visibility Attributes Name Initial
real(kind=double), public :: double_real
real(kind=float), public :: float_real
integer(kind=long), public :: long_int
integer(kind=short), public :: short_int

Source Code

LOGICAL FUNCTION SizesOK &
!
()

IMPLICIT NONE

! Local scalars:
INTEGER (KIND = short)  :: short_int
INTEGER (KIND = long)   :: long_int
REAL    (KIND = float)  :: float_real
REAL    (KIND = double) :: double_real
!------------end of declaration------------------------------------------------

  IF (BIT_SIZE( short_int) == 32  .AND. BIT_SIZE( long_int) == 64 .AND.  &
      float > 0 .AND. double > 0  .AND. float /= double                  ) THEN
      SizesOK = .TRUE.
  ELSE
      SizesOK = .FALSE.
  END IF
END FUNCTION SizesOK